package com.josn.messagewall.controller;

import com.josn.messagewall.mapper.MessageMapper;
import com.josn.messagewall.pojo.Message;
import com.josn.messagewall.utils.GenerateSnowidUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MessagewallController {

    @Autowired
    private GenerateSnowidUtil generateSnowidUtil;

    @Autowired
    private MessageMapper messageMapper;

    @PostMapping("/message")
    public void receivemessage(String messageinfo) {
        Message msg = new Message();
        msg.setId(generateSnowidUtil.nextId());
        msg.setMessageinfo(messageinfo);
        messageMapper.insertmessage(msg);
    }
}
